<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 根据位置返回字符
        // 1. charAt(index) 根据索引号返回字符
        let str = "1415161312";
        console.log(str.charAt(5));

        // 2. str[index] H5 新增的
        console.log(str[6]);

        // 3. charCodeAt(index)  返回相应索引号的字符 ASCII 值 目的： 判断用户按下了那个键
        console.log(str.charCodeAt(5));

        // 4. ASCII码值转换为对应字符
        let result = String.fromCharCode(12);
        console.log(result);

        let arr = [];
        for (let i = 40; i < 91; i++) {
            let temp = String.fromCharCode(i);
            arr.push(temp);
        }
        console.log(arr);

    </script>
</body>
</html>